﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
using System.Timers;
using SignalR;
using EvinceUI.Helper;

namespace EvinceUI
{
    // Note: For instructions on enabling IIS6 or IIS7 classic mode, 
    // visit http://go.microsoft.com/?LinkId=9394801

    public class MvcApplication : System.Web.HttpApplication
    {
        protected void Application_Start()
        {
            //System.Timers.Timer myTimer = new System.Timers.Timer();
            //myTimer.Elapsed += new ElapsedEventHandler(OnTimer);
            //myTimer.Interval = 1000;
            //myTimer.Enabled = true;
            //myTimer.AutoReset = false;
            AreaRegistration.RegisterAllAreas();
            RouteTable.Routes.MapHubs("~/signalr/hubs");
            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            AuthConfig.RegisterAuth();
            GlobalHost.DependencyResolver.Register(typeof(IConnectionIdGenerator), () => new UserIdClientIdFactory());
        }
        //public void OnTimer(Object source, ElapsedEventArgs e)
        //{
        //    System.Timers.Timer theTimer = (System.Timers.Timer)source;
        //    theTimer.Interval = 1000;
        //    theTimer.Enabled = true;
        //    EvincePayrollService ws = new EvincePayrollService(ServiceTypes.Employee);    
        //    if (System.DateTime.Now.TimeOfDay.ToString().Split('.')[0] == "16:55:00")
        //    {
        //        var result = ws.MarkAubsent();
        //    }
        //}
    }
}